<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<html>
	<head>
		<base target="_self" />
		<meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
		<title>添加材料信息</title>
		<link rel="stylesheet" type="text/css" href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
		<link rel="stylesheet" type="text/css"
			href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/js/json2.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
		<script type="text/javascript" src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>		

 
    <script type="text/javascript">
    	
		
			function initList(listDisplayEId) {
				$('#' + listDisplayEId).datagrid(
						{
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							/* frozenColumns : [ [ {
								field : 'ids',
								checkbox : true
							} ] ], */
							onDblClickRow: function (rowIndex, rowData) {  
								$('#listDisplay').datagrid('beginEdit', rowIndex);
							},
							toolbar : [],
							onLoadError:function(){
								$.messager.alert('错误','获取数据失败，请与管理员联系！','error');
							}
						});
			};
			$(document).ready(function() {
				initList('listDisplay');
			});
			 
 		function searchInfo(){
	 
			$('#listDisplay').datagrid('load', {
				materName : $('#materName').val(),
				materType : $('#materType').val()
			}); 
 		}
 		
 		//添加信息按钮响应函数
		function addFood(){
 			$('#AddFoodForm').form('submit',
			{
				url:'<c:url value='/unit/updateUnitMenu.do'/>', //查询提交路径
				onSubmit:function()//提交按钮相应函数
				{
					return $('#AddFoodForm').form('validate');
				},
				success:function(data){
					data = eval('(' + data + ')');
	       			if(data.success){
	       				$.messager.alert('系统提示', '修改成功', 'info', function(){
				            window.close();
				        });
       				}else{
       					var message = "";
       					if(data.msg == "msg001"){
       						message = "当前机构此日菜单已经录入！";
       					}
	       				$.messager.alert("提示", message, 'warning');
       				}
				},
				error:function(){
					$.messager.alert("错误", "系统错误，请联系管理员！", 'error');
					return;
				}
			});
 			
		}

	    $(function() {
	          
	          // 下拉框选择控件，下拉框的内容是动态查询数据库信息  
	          $('#unitId').combobox({   
	                  url:"<c:url value='/unit/pulldownUnitId.do?space=0'/>",   
	                  editable:true, //不可编辑状态  
	                  cache: false,  
	                  panelHeight: '150',  
	                  valueField:'unitId',     
	                  textField:'unitName',  
	                  required:true
	          });  
	    });  
		</script>
    <!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>

  <body>
    <table width="90%" align="center">
	  <tr></tr>
	  <tr>
		<td>
		
		  <div style="height: auto; background: #fafafa; padding: 5px;" class="easyui-panel" title="添加菜单信息" iconCls="icon-save" 
		  collapsible="true" minimizable="false" maximizable="false" closable="false">
			
			<form id="AddFoodForm" name="AddFoodForm" method="post">
			   <table cellpadding="5">
			      <tr>
                  	<td>
				  		<input class="easyui-validatebox"  type="hidden" name="menuId" id="menuId" value="${unitMenuVo.menuId }" >
				  		<input class="easyui-validatebox"  type="hidden" name="unitCode" id="unitCode" value="${unitMenuVo.unitCode }" >
				  		
 			      	</td>
                  </tr>
                  <tr>
                  	<td>机构:</td>
                  	<td>
				  		<input class="easyui-combobox"   readOnly="true"  name="unitId" id="unitId"  data-options="required:true"  value="${unitMenuVo.unitId }">
 			      	</td>
                  </tr>
                 
                  <tr>
                  	<td>描述:</td>
                  	<td>
				  		<input class="easyui-textbox"  name="menuText" id="menuText" editable="true" data-options="multiline:true,required:true" style="height:60px;width:300px" value="${unitMenuVo.menuText }" /> 
 			      	</td>
                  </tr>
                  
                  <tr>
                  	<td>日期:</td>
                  	<td>
				  		<input class="easyui-validatebox" readOnly="true" id="menuDate" data-options="required:true" name="menuDate" value="${unitMenuVo.menuDate }" ></input>
 			      	</td>
                  </tr>
                  
  			   </table>
   			   <a class="easyui-linkbutton" onclick="addFood()">修改</a>
   			</form>
		  
		  </div>
		</td>
	  </tr>
	</table>
  </body>
</html>